module UserLogosHelper
  
  def current_user_logo_image_tag(args)
    user_logo_image_tag current_user,args
  end
  
  def user_logo_image_tag(user,args)
    args = {
      :title => "#{user.nick_name}",
      :alt => "#{user.nick_name}"
    }.merge args
    if user.logo
      image_tag user_logo_url(user.logo,:jpg), args
    else
      image_tag "users/#{user.sex}.png",args
    end
  end
  
  def link_to_new_or_edit_current_user_logo(html_options = {})
    link_to_new_or_edit_user_logo current_user, html_options
  end
  
  def link_to_new_or_edit_user_logo(user,html_options = {})
    link_to '✎设置头像', new_user_logo_url, { :title => '设置您的个性头像' }.merge(html_options)
  end
end
